<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

</head>

<body>
    <div id="app">
        <!--  声明式渲染 -->
        {{message}}
        <!--条件与循环  -->
        <p v-if="seen"> now you can see me </p>
        <ol>
            <li v-for="todo in todos">
                {{todo.text}}
            </li>
        </ol>
        <!-- 处理用户输入 -->
        <button v-on:click="reverseMessage">button点击{{message}}</button>

    </div>


    <script>
        new Vue({
            el: "#app",
            data: {
                message: "hello",
                seen: true,
                todos: [
                    { text: "hell1" },
                    { text: "hello2" }
                ]
            },
            methods: {
                reverseMessage: function(){
                    this.message = this.message.split('').reverse().join('');
                }
            },
        })
    </script>

</body>

</html>